﻿using System.ServiceModel;
using System.ServiceProcess;
using Gpf.Whs.YouTubeDownloader.CommSrv;

namespace Gpf.Whs.YouTubeDownloader.Service
{
    public partial class DownloaderService : ServiceBase
    {
        private ServiceHost _host;

        public DownloaderService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            var serviceType = typeof(YouTubeDownloaderCommSrv);
            _host = new ServiceHost(serviceType);
            _host.Open();
        }

        protected override void OnStop()
        {
            if (_host != null)
                _host.Close();
        }
    }
}
